package com.kid.kidliving.commodity.config;

import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.EnableTransactionManagement;

@Configuration
@EnableTransactionManagement//开启事务
@MapperScan("com.kid.kidliving.commodity.dao")
public class MyBatisConfig {

    @Bean
    public PaginationInterceptor paginationInterceptor() {
        //引入分页插件
        PaginationInterceptor paginationInterceptor = new PaginationInterceptor();

        //基本设置
        //溢出总页数，设置第一页
        paginationInterceptor.setOverflow(true);
        //单页限制100条
        paginationInterceptor.setLimit(100);
        return paginationInterceptor;
    }
}
